package com.info.zhiduoduo.repository.mapper.system;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.info.zhiduoduo.repository.dto.system.SensitiveVocabularyDto;
import com.info.zhiduoduo.repository.entity.system.SensitiveVocabulary;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SensitiveVocabularyMapper extends BaseMapper<SensitiveVocabulary> {

    @Select(" SELECT * FROM zdd_sensitive_vocabulary " +
            " WHERE parentid = 0 " +
            " AND sensitive_words LIKE '%${sensitivewords}%' ")
    List<SensitiveVocabularyDto> sensitiveVocabularyList(@Param("sensitivewords") String sensitivewords);

    @Select(" SELECT GROUP_CONCAT(DISTINCT(sensitive_words) SEPARATOR '、') as words " +
            " from zdd_sensitive_vocabulary " +
            " where parentid != 0 " +
            " and LOCATE(sensitive_words,#{sensitiveWords}) ")
    String checkSensitiveWord(@Param("sensitiveWords") String sensitiveWords);

    @Select(" select * from  zdd_sensitive_vocabulary  where parentid = #{parentid} ")
    List<SensitiveVocabularyDto> getSecondary(int parentid);


}
